// Taking care of some special events.
void keypadEvent(KeypadEvent key){
	keyState = keypad.getState();
	unsigned long currentTime = millis();   
	if(keyState == PRESSED)
	{
		if((keyPreviuos == key) && ((currentTime - timePreviuos) < timeDistance)) 
		{
			columnKey = (columnKey + 1) % keyNum;
		}
		else 
		{
			columnKey = 0;
			timeStartPress = 1;
		}		
		uint8_t rowKey = getRowKey(key);
		uint8_t column = columnKey;
		timePreviuos = currentTime;
		if(keyMode == TEXTMODE) 
		{
			if(column == keyNum - 1) column = 1;
		}
		else if(keyMode == NUMBERMODE) 
		{
			column = keyNum - 1;
		}		
		keySelect = keyChars[rowKey*keyNum + column];
		keyPreviuos = key;    
	}
	else if(keyState == RELEASED) 
	{
		timeStartPress = currentTime;
	}
	else if(keyState == HOLD){
		keySelect = key;
		timeStartPress = currentTime;
	}
	else if(keyState == IDLE) 
	{
	}
}
uint8_t getRowKey(char key){
	switch(key)
	{
	case 'A':
	case 'B':
	case 'C':
	case 'D':
		return key - 55;
	case '*': 
		return 14;
	case '#': 
		return 15;
	default:
		return key - 48;
	}
	return '\0';
}

